AI Verified
Changing “Out of stock” Text with A Snippet
Simple products will have the default “out of stock” message. It’s really easy to change this to display another message, such as sold out or anything else. We need to access the woocommerce_get_availability_text filter to change the availability message. We can also change the available stock message. Advanced users can tap into the product details and create unique messages based on any conditions. For example, one condition could be if the product is in a specific category or not. I’ll include some bonus product conditions at the bottom for you to mix and match.
PHP
Voted: 0 by 0 user(s)
add to functions.php
The author has provided the following URL that may be helpful to setting up or using this snippet:
https://puri.io/blog/change-stock-availability-text-woocommerce/Scroll down to see more snippets from this codevault.
The author has indicated that this snippet is compatable up to wordpress version: 6.4
Our AI bot has checked this snippet is compatable up to wordpress version: 6.1
Free & Pro
Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.
Pro Only (Coming Soon)
You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.
Last modified:
21/03/2024
This snippet has the following status:
AI Verified
This snippet has been tested by our AI bot, see any comments below.
AI Bot Comments:
Found 0 vulnerabilities
0
Please see some snippets below related to this snippet..
WooCommerce
AI Verified
Added: 1 year ago
Last Updated: 1 day ago
This snippet inserts a progress bar on the product page to let customers know how many units you have in stock. The visual representation conveys more scarcity because they will be able to see not onl...
WooCommerce
AI Verified
WooCommerce
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
This snippet adds jQuery (run form the footer for performance reasons) which only allows number input in the billing phone field on the checkout. Specifically, it will find and delete anything which i...
These are some popular snippets from this users codevault..
General
AI Verified
Added: 1 year ago
Last Updated: 3 days ago
This code defines a function named default_post_metadata__thumbnail_id that modifies the value of the _thumbnail_id metadata field for a post. The function takes five arguments: $value: The current...
WordPress Admin
AI Verified
Added: 1 year ago
Last Updated: 4 months ago
This will disable comments on the entire site
WordPress Admin
AI Verified
Added: 1 year ago
Last Updated: 9 months ago
This will disable automatic updates
Category
Snippet Status